package com.baitengsoft.patentapimonitor.api.dao;


import com.baitengsoft.patentapimonitor.api.entity.PacPatentinfoEntity;
import com.baitengsoft.patentapimonitor.api.model.*;
import com.baitengsoft.patentapimonitor.api.model.param.SearchExpiryNoticeParam;
import com.baitengsoft.patentapimonitor.api.model.param.SearchMonSummaryParam;
import com.baitengsoft.patentapimonitor.api.model.param.WebPatentApplySearchParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * @author Chen 2017/12/21
 */
@Mapper
@Repository
public interface PacPatentinfoDao extends BasetkRepository<PacPatentinfoEntity> {
    /**
     * 根据参数查询专利申请
     */
    List<WebPatentApplyModel> getWebPatentApplyList(@Param("param")WebPatentApplySearchParam param, @Param("platformid") Integer platformid);

    /**
     * 根据失效时间查询即将失效个数(发明)
     */
    Integer getFMExpiredInfo(@Param("expiredmonths") Integer expiredmonths,@Param("platformId")Integer platformId);

    /**
     * 根据失效时间查询即将失效个数（其他）
     */
    Integer getExpiredInfo(@Param("expiredmonths") Integer expiredmonths,@Param("platformId")Integer platformId);

    /**
     * 今年转入数据
     */
    Integer getInByYear(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("platformId")Integer platformId);

    /**
     * 几年转出
     */
    Integer getOutByYear(@Param("startDate") Date startDate, @Param("endDate") Date endDate,  @Param("platformId")Integer platformId);

    /**
     * 获取今年专利失效
     */
    Integer getExpiredYear(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("platformId") Integer platformId);

    /**
     *列表查询
     */
    List<WebMonSummaryInfo> queryList(@Param("param") SearchMonSummaryParam param,
                                      @Param("platformid") Integer platformid,
                                      @Param("startDate") String startDate,
                                      @Param("endDate") String endDate,
                                      @Param("qtcompareDate") String qtcompareDate,
                                      @Param("fmcompareDate")String fmcompareDate,
                                      @Param("expiredmonths" )Integer expiredmonths
    );

    /**
     * 转入统计
     */
    List<WebMonAnalysisInfo> getAnalysisByArea(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("platformId") Integer platformId,@Param("order") String order,@Param("sort")String sort);

    /**
     * 转出统计
     */
    List<WebMonAnalysisInfo> getOutAnalysisByArea(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("platformId") Integer platformId,@Param("order") String order,@Param("sort")String sort);

    /**
     * 获取失效列表
     */
    List<WebMonInvalidAnalysisInfo> geInvalidList(@Param("startDate") Date startDate,
                                                  @Param("endDate") Date endDate,
                                                  @Param("platformId") Integer platformId,
                                                  @Param("order") String order,
                                                  @Param("sort")String sort);

    /**
     * 获取届满通知列表
     */
    List<WebExpiryNoticeInfo> getExpiryNoticeList(@Param("platformid") Integer platformid,
                                                  @Param("param")SearchExpiryNoticeParam param,
                                                  @Param("startDate") Date startDate,
                                                  @Param("endDate") Date endDate
    );

    /**
     * 专利权转入数据
     */
    List<WebApplyChangeInfo> getApplyChangeInList(@Param("platformid")Integer platformid,
                                                  @Param("param")SearchExpiryNoticeParam param,
                                                  @Param("startDate") Date startDate,
                                                  @Param("endDate") Date endDate
    );
    /**
     * 专利权转出数据
     */
    List<WebApplyChangeInfo> getApplyChangeOutList(@Param("platformid")Integer platformid,
                                                   @Param("param")SearchExpiryNoticeParam param,
                                                   @Param("startDate") Date startDate,
                                                   @Param("endDate") Date endDate
    );

    /**
     * 失效分析
     */
    List<WebInvalidAnalysisInfo> getInvalidAnalysisList(@Param("platformid")Integer platformid,
                                                        @Param("param")SearchExpiryNoticeParam param,
                                                        @Param("startDate") Date startDate,
                                                        @Param("endDate") Date endDate
    );

    /**
     * 【概览】获取失效专利原因汇总
     * @param platformid
     * @return
     */
    List<WebInvalidReasonInfo> getInvalidReasonInfo(@Param("platformid") Integer platformid);

    int getInvalidPatCount(@Param("platformid") Integer platformid);

    /**
     * 概览 获取专利总量
     */
    WebHomePatentSummaryInfo getPatCountSum(@Param("platformid") Integer platformid);
}
